//
//  RYChatBaseView.m
//  SanYiTeaching
//
//  Created by ChenHao on 2019/8/6.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "RYChatBaseView.h"
#import "RYChatViewController.h"
@interface RYChatBaseView ()
{
    UIView *blankView;
    RYChatViewController *chatVC;
}
@end
@implementation RYChatBaseView

- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self createBlankView];
    }
    return self;
}
-(void)createBlankView{
    blankView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
    blankView.backgroundColor = [UIColor whiteColor];
    [self addSubview:blankView];
}
-(void)setChatViewWithTagerId:(NSString *)tageId{
    if (chatVC != nil) {
        [chatVC.view removeFromSuperview];
        chatVC = nil;
    }
    blankView.hidden = YES;
    chatVC = [[RYChatViewController alloc] init];
    chatVC.conversationType = ConversationType_GROUP;
    chatVC.targetId = tageId;
    chatVC.view.frame = CGRectMake(0, -20, self.bounds.size.width, self.bounds.size.height);
    chatVC.view.userInteractionEnabled = YES;
    [self addSubview:chatVC.view];
    
}
@end
